package com.mentaleye.controller;

import com.mentaleye.biz.CompanyStudentBiz;
import com.mentaleye.biz.DictionaryBiz;
import com.mentaleye.enums.DictionaryEnums;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;
import java.util.Map;

/**
 * Created by Rock on 2017/5/25.
 */
@Controller
@RequestMapping("/companyStudent")
public class CompanyStudentController {

    @Autowired private CompanyStudentBiz companyStudentBiz;
    @Autowired private DictionaryBiz dictionaryBiz;

    @RequestMapping("/showStudent")
    public ModelAndView showStudent(@RequestParam(value = "companyId") Integer companyId){
        ModelAndView view = new ModelAndView("em/company/showStudent");
        Map<Integer, String> workStateMap = dictionaryBiz.queryDictionaryByParent(DictionaryEnums.WORK_STATE.getCode());
        List<Map<String, Object>> data = companyStudentBiz.queryStudentByCompanyId(companyId);
        view.addObject("dataList",data);
        view.addObject("workStateMap", workStateMap);
        return view;
    }
}
